<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>科目列表</title>
    <link rel="shortcut icon" href="/favicon.ico">
    <link href="/public/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/public/admin/css/animate.css" rel="stylesheet">
    <link href="/public/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <link href="/public/admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <base target="_blank">
    <!-- 全局js -->
    <script src="/public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/admin/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/public/admin/js/plugins/layer/layer.min.js"></script>
    <!-- 自定义js -->
    <script src="/public/admin/js/content.js?v=1.0.0"></script>
    <script src="/public/admin/js/contabs.js"></script>
    <script src="/public/admin/js/common.js"></script>
    <script src="/public/admin/js/article.js"></script>

    <!-- Bootstrap table -->
    <script src="/public/admin/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/public/admin/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="/public/admin/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>科目列表（不允许编辑，成绩统计需固定科目）</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header" style="display:none">
                                    <div class="panel-body">
                                        <div>
                                            <a onclick="openYemian('/index.php/Admin/Subject/subjectAdd','添加科目')" href="javascript:;" class="btn btn-primary"><i class="fa fa-plus"></i>新增</a>
                                            <a onclick="javascript:window.location.href=location.href;" href="javascript:;" class="btn btn-primary"><i class="glyphicon glyphicon-refresh"></i>刷新</a>
                                        </div>
                                    </div>
                                </div><!-- /.box-header -->
                                <div class="box-body">
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div id="ajaxList">
                                                <form method="post" enctype="multipart/form-data" id="form-order">
                                                    <table class="table table-bordered">
                                                        <thead>
                                                        <tr>
                                                            <th>ID</th>
                                                            <th>类型</th>
                                                            <th>科目名称</th>
                                                            <th style="display:none">操作</th>
                                                        </tr>
                                                        </thead>
                                                        <tbody id="ajaxList">
                                                        {if empty($list)}
                                                        <tr role="row">
                                                            <td colspan="9" align="center">暂无数据</td>
                                                        </tr>
                                                        {/if}
                                                        {foreach name="list" item="v" key="k" }
                                                        <tr role="row">
                                                            <td>{$v.subjectid}</td>
                                                            <td>
                                                                {if $v['art_type']==0}
                                                                文理科
                                                                {elseif $v['art_type']==1 /}
                                                                文科
                                                                {elseif $v['art_type']==2 /}
                                                                理科
                                                                {/if}
                                                            </td>
                                                            <td>{$v.subject_name}</td>
                                                            <td style="display:none">
                                                                <a class="btn btn-primary" href="javascript:;" title="编辑" onclick="openYemian('/index.php/Admin/Subject/subjectAdd/id/{$v.subjectid}','编辑科目')"><i class="fa fa-pencil"></i></a>
                                                                <a class="btn btn-danger" href="javascript:void(0)" title="删除" onclick="delarticle(this,'确定删除该科目？此操作不可恢复！',{$v.subjectid},'/index.php/Admin/Subject/subjectDel')"><i class="fa fa-trash-o"></i></a>
                                                            </td>
                                                        </tr>
                                                        {/foreach}
                                                        </tbody>
                                                    </table>
                                                </form>
                                                <script>
                                                    // 点击分页触发的事件
                                                    $(".pagination li").removeClass('disabled');
                                                    $(".pagination  a").click(function(){
                                                        cur_page = $(this).data('p');
                                                        $(this).attr('href');
                                                        if ($(this).attr('href') != '#'){
                                                            window.location.href = $(this).attr('href');
                                                        }
                                                        return false;
                                                    });

                                                </script>
                                            </div>
                                        </div>
                                    </div>
                                </div> <!-- /.box-body -->
                            </div><!-- /.box -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<input id="handle_status" value="" hidden="hidden">
<script>

    function delarticle(obj,name,id,url) {
        top.layer.confirm(name,{
            icon : 3,
            btn:['确定','取消'],
        } , function(){
            $.ajax({
                url : url,
                type : "post",
                data : {id:id,act:'del'},
                dataType : "json",
                success:function(data){
                    if (data.status == 0) {
                        top.layer.msg(data.message);
                    } else {
                        top.layer.msg(data.message);
                        $(obj).parent().parent().remove();
                        var total = $("#total").html()-1;
                        $("#total").html(total);
                    }
                }
            });
        } , function(){
            layer.close(); //再执行关闭
        })
    }

    // 删除选中
    function delselect(){
        parent.layer.confirm('确定要删除选中吗？', function(){
            url = window.location.href;
            $.ajax({
                url:"/index.php/Admin/message/delselect",
                data : $('#form-order').serialize(),
                success: function(v){
                    var v =  eval('('+v+')');
                    parent.layer.msg(v.message, {icon: v.icon,time: 1000});
                    if(v.status == 1){
                        window.location = window.location;
                    }
                    // if(v.hasOwnProperty('status') && (v.status == 1))
                    //     getAjaxList('ajaxList',1,"/index.php/Admin/Article/ajaxArticleList");
                }
            });
        });
    }

</script>

</body>

</html>